home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Tools&Utilities / TouchMe 1.2□ / touchMe 1.2 Folder / touchMe source codes / CW11 PP source / source / CTouchMePref.h < prev    next >
Encoding:
Text File  |  1997-04-25  |  2.5 KB  |  95 lines  |  [TEXT/CWIE]

  1. // ==================================================
  2. //    CTouchMePref.h
  3. //    Copyright (C) 1996-1997 Mizutori Tetsuya
  4. //    July 4 ,1996; February 3, 1997; April 23, 1997.
  5. // ==================================================
  6. //    All documents are pretty-printed in 10-point Geneva font.
  7.  
  8. #pragma once
  9.  
  10. #include "CPrefsFile.h"
  11.  
  12.  
  13. typedef enum {
  14.     touchType_CreationDate = 0,    // must start with 0
  15.     touchType_ModificationDate,
  16.     touchType_END
  17. } ETouchType;
  18.  
  19.  
  20. typedef enum {
  21.     touchFlag_Current = 0,    // must start with 0
  22.     touchFlag_Direct,
  23.     touchFlag_First,
  24.     touchFlag_Second,
  25.     touchFlag_Null,
  26.     touchFlag_END            // the number must be a multiles by 2
  27. } ETouchFlag;
  28.  
  29.  
  30. // This structure is same to that of resource type 'PREF'.
  31. typedef struct {
  32.     Uint32        version;
  33.     Rect            wframe;
  34.     Int16        sync;
  35.     Int16        reserved_1;            // for 4-byte alignment
  36.     Int16        enabled[touchType_END];    // must be 4-byte multiples
  37.     Int16        flag[touchType_END];        // must be 4-byte multiples
  38.     Uint32        datetime[touchType_END];
  39. } SPrefsRec, *SPresfPtr, **SPrefsHandle;
  40.  
  41. class LWindow;
  42.  
  43. class    CTouchMePref : public CPrefsFile {
  44.  
  45. public:
  46.                     CTouchMePref();
  47.                     CTouchMePref( ConstStr255Param inFileName );
  48.     virtual             ~CTouchMePref();
  49.  
  50.     // Load prefs data from the Preferences file.
  51.     OSErr            LoadPrefsData( void );
  52.  
  53.     // Save prefs data to the Preferences file.
  54.     OSErr            SavePrefsData( void );
  55.  
  56.     // Set the window's settings by prefs data.
  57.     void                SetPrefsToWindow( LWindow * inWindow );
  58.  
  59.     // Get the window's settings to prefs data.
  60.     void                GetPrefsFromWindow( LWindow * inWindow );
  61.  
  62.     // Set and Get the settings data of the member 'XXX'
  63.     void                SetWindowRect( Rect & inWindowRect );
  64.     void                GetWindowRect( Rect & outWindowRect );
  65.  
  66.     void                SetSync( const Boolean inStatus );
  67.     Boolean            GetSync( void );
  68.  
  69.     void                SetEnabled( const ETouchType inType, const Boolean inStatus );
  70.     Boolean            GetEnabled( const ETouchType inType );
  71.  
  72.     void                SetFlag( const ETouchType inType, const ETouchFlag inFlag, const Boolean inStatus );
  73.     Boolean            GetFlag( const ETouchType inType, const ETouchFlag inFlag );
  74.  
  75.     void                SetFlagNumb( const ETouchType inType, const ETouchFlag inFlag );
  76.     ETouchFlag            GetFlagNumb( const ETouchType inType );
  77.  
  78.     void                SetDateTime( const ETouchType inType, const unsigned long inValue );
  79.     unsigned long        GetDateTime( const ETouchType inType );
  80.  
  81.  
  82. private:
  83.  
  84.     void                SetupConstants( void );
  85.  
  86.     // Transform preferences data to/from 'mPrefs' record.
  87.     void                TransformToSettings( void );
  88.     void                TransformFromSettings( void );
  89.  
  90.     // A working data structure for handling preferences file
  91.     SPrefsRec            mPrefs;
  92. };
  93.  
  94. // end of definitions
  95.